﻿

namespace KinonekoSoftware.Foundation.UI.Controls.Buttons
{
    public class MoreButton : ForestButtonBase
    {

        public static readonly DependencyProperty IsHorizontalProperty;

        static MoreButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(MoreButton), new FrameworkPropertyMetadata(typeof(MoreButton))); 
            IsHorizontalProperty = DependencyProperty.Register(
            nameof(IsHorizontal),
            typeof(bool),
            typeof(MoreButton),
            new PropertyMetadata(Boxing.True));
        }

        protected override void OnClick()
        {
            if(ContextMenu is not null)
            {
                ContextMenu.PlacementTarget = this;
                ContextMenu.Placement = PlacementMode.Bottom;
                ContextMenu.IsOpen = true;
            }
            base.OnClick();
        }

        public bool IsHorizontal
        {
            get => (bool)GetValue(IsHorizontalProperty);
            set => SetValue(IsHorizontalProperty, Boxing.Box(value));
        }
    }
}